import pyautogui

# 教程
# https://cloud.tencent.com/developer/article/2462648
# 获取鼠标当前位置
x, y = pyautogui.position()
print(f"当前鼠标位置: ({x}, {y})")

width, height = pyautogui.size()
print(f"屏幕宽x高: ({width}, {height})")

# 将鼠标移动到 (100, 100) 位置，单位1s
# pyautogui.moveTo(100, 100, duration=1)  # duration 是移动持续时间，单位为秒

onScreen = pyautogui.onScreen(100, 10000)
print(f"坐标是否在屏幕内:  {onScreen} ")

# 鼠标左键点击位置(1232, 638)
pyautogui.click(1232, 638)

# 弹出消息框
pyautogui.alert('This displays some text with an OK button.')

# 弹出对话框
# 返回值是 OK 或 Cancel
confirm = pyautogui.confirm('This displays text and has an OK and Cancel button.')
print(f"confirm:{confirm}")